package com.ruitu.mall_98_seller.mvp.model;

import com.ruitu.arad.api.BaseResult;
import com.ruitu.arad.api.RxUtil;
import com.ruitu.arad.base.BaseModel;
import com.ruitu.mall_98_seller.dao.http.APIRetrofit;
import com.ruitu.router_module.bean.Version;

import io.reactivex.Observable;
import io.reactivex.schedulers.Schedulers;
import okhttp3.ResponseBody;

public class HomeModel {
    // 首页
    public static class HomeM extends BaseModel {
        public Observable<BaseResult> reqHomeNums(String comId) {
            return APIRetrofit.getDefault().reqHomeNums(comId)
                    .compose(RxUtil.<BaseResult>subIoObMain());
        }

        public Observable<BaseResult<Version>> reqNewVersion(String type) {
            return APIRetrofit.getDefault().reqNewVersion(type)
                    .compose(RxUtil.<BaseResult<Version>>subIoObMain());
        }

        public Observable<ResponseBody> downloadApk(String url) {
            return APIRetrofit.getDownload().downloadApk(url)
                    .subscribeOn(Schedulers.io())
                    .observeOn(Schedulers.io());
        }
    }
}
